package com.mochasoft.shangchm.type;


public class CaiPiaoFactory {
	
	private static CaiPiaoFactory factory;
	
	private static final int FLCP_R = 1;

	private static final int FLCP_B = 2;

	private static final int TYCP = 3;
	
	private CaiPiaoFactory(){
		
	}
    public static synchronized CaiPiaoFactory getInstance(){
    	if(factory == null)
    		factory = new CaiPiaoFactory();
    	return factory;
    }
    
    public ICaiPiao getCaiPiaoInstance(String type){
    	ICaiPiao caipiao = null;
    	switch (getType(type)) {
		case FLCP_R:
			caipiao = new DoubleColorBall();
			caipiao.setMaxNumber(33);
			caipiao.setSize(6);
			break;
		case FLCP_B:
			caipiao = new DoubleColorBall();
			caipiao.setMaxNumber(16);
			caipiao.setSize(1);
			break;
		case TYCP:
	           
			break;
		default:
			break;
		}
    	return caipiao;
    }
    
    private int getType(String type){
    	int i = 0;
    	if(type.equalsIgnoreCase("FLCP_R")){
    		i = FLCP_R;
    	}else if(type.equalsIgnoreCase("FLCP_B")){
    		i = FLCP_B;
    	}else if(type.equalsIgnoreCase("TYCP")){
    		i = TYCP;
    	}
    	return i;
    }
}
